home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-10-13 | 1.1 KB | 43 lines | [TEXT/MACA] |
- type
- Buffer = packed array[0..254] of char;
- BufferPtr = ^Buffer;
-
-
- function FSReadLine(refNum: Integer;request:Longint;var count: Longint;
- abuffer:BufferPtr):OSErr;
-
- {Reads in one line of text from a textfile and puts the chars in aBuffer
- Can be used for reading text in a desk accesory}
- var
- iopb : ParamBlockRec;
- result : OSErr;
-
- begin
- iopb.ioResult := noErr;
- iopb.ioRefNum := refNum;
- iopb.ioBuffer := Pointer(abuffer);
- iopb.ioReqCount := request;
- iopb.ioActCount := 0;
- iopb.ioPosMode := $0d80;
- iopb.ioPosOffset := 0;
- FSReadLine := PBRead(@iopb,False);
- count := iopb.ioActCount;
- end;
-
- var
- theErr : Integer; {If an error does occur }
- bytesRead : LongInt; {Number of bytes actually read}
-
-
- begin
- {Pass to FSReadLine:
- fRef = file reference (integer)
- bytes = number of bytes to attempt to read (longInt)
- Get back:
- theErr = file error (integer)
- bytesRead = bytes actually read (longInt)
- commRd = buffer of chars (BufferPtr)}
-
- theErr := FSReadLine(fRef,255,bytesRead,commRd);
- end.